﻿using System;
using System.Collections.Generic;
using System.Text;
using EmbeddedSharp.Core;

namespace EmbeddedSharp.Core.Function.Logic {
    public class LessThanNode : LogicOperatorNode {

        public LessThanNode()
            : base() {
            base.Value = "<";
        }

        public override FuncNode GetReversedFunction(int index) {
            return new LargerThanNode();
        }

        public override object Evaluate() {
            double lr = Convert.ToDouble(Left.Evaluate());
            double rr = Convert.ToDouble(Right.Evaluate());

            return Convert.ToString(lr < rr);
        }

        public override object Accept(IVisitor visitor) {
            return visitor.Visit(this);
        }
    }
}
